<!-- 楼层 -->
<template>
    <div class="floorDetail">
        <div class="floor-left">
            <div class="selectValue">
                <label class="value">
                    <span class="img">
                        <img src="../../../assets/images/airIndex/qst.png" />
                    </span>
                    <!-- <span class="title">用{{ getTitle() }}量趋势图</span> -->
                    <span class="title">趋势图</span>
                </label>
                <div class="rightValue">
                    <div class="btnList">
                        <iconBorder
                            outWidth="40px"
                            inWidth="20px"
                            bgColor="#D7E5FB"
                            imgSrc="newIndex/new/1.png"
                            marginTop="10px"
                        ></iconBorder>
                        <iconBorder
                            outWidth="40px"
                            inWidth="20px"
                            bgColor="#D7E5FB"
                            imgSrc="newIndex/new/2.png"
                            marginTop="10px"
                        ></iconBorder>
                        <iconBorder
                            outWidth="40px"
                            inWidth="20px"
                            bgColor="#D7E5FB"
                            imgSrc="newIndex/new/3.png"
                            marginTop="10px"
                        ></iconBorder>
                    </div>
                </div>
            </div>
            <div class="floor-left-top-table">
                <deviceLeftEcharts
                    :name="phIndex"
                    :key="phIndex"
                    :currentNodeId="currentNodeId"
                    :currentNodeName="currentNodeName"
                    :dir="dir"
                ></deviceLeftEcharts>
            </div>
            <div class="floor-left-bottom-table">
                <div class="floor-left-bottom-table-item">
                    <deviceLeftPieZb></deviceLeftPieZb>
                </div>
                <div class="floor-left-bottom-table-item">
                    <deviceLeftTableList></deviceLeftTableList>
                </div>
                <div class="floor-left-bottom-table-item" style="margin-right: 0; width: calc((100%) / 3)">
                    <deviceLeftTableSbList></deviceLeftTableSbList>
                </div>
            </div>
        </div>
        <div class="floor-right">
            <div
                class="floor-left-top-table"
                style="height: 360px; margin-top: 0px !important; background-color: transparent; overflow: hidden"
            >
                <div class="items" style="box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4)">
                    <div class="itemsTitle">
                        <div class="itemsTitleLeft">
                            <img src="../../../assets/images/airIndex/nzydl.png" />
                            <label>年总用电量（KWH）</label>
                        </div>
                        <el-select
                            v-model="year"
                            style="width: 80px"
                            @change="
                                (e) => {
                                    console.log(e)
                                }
                            "
                        >
                            <el-option
                                :label="select.label"
                                :value="select.value.toString()"
                                v-for="(select, sIndex) in yearList"
                                :key="sIndex"
                            ></el-option>
                        </el-select>
                    </div>
                    <div class="itemsContent" style="padding-top: 20px">
                        <div class="itemsContentRightValue">8888818231.23</div>
                    </div>
                </div>
                <div class="items">
                    <div class="itemsTitle">
                        <div class="itemsTitleLeft">
                            <img src="../../../assets/images/airIndex/energy/4.png" />
                            <label>空调耗电量（年）</label>
                        </div>
                    </div>
                    <div class="itemsContent">
                        <div class="itemsContentLeftValue red">
                            65%

                            <img src="../../../assets/images/airIndex/energy/14.png" />
                        </div>
                        <div class="itemsContentRightValue">818231.23</div>
                    </div>
                </div>
                <div class="items">
                    <div class="itemsTitle">
                        <div class="itemsTitleLeft">
                            <img src="../../../assets/images/airIndex/energy/17.png" />
                            <label>照明插座耗电量（年）</label>
                        </div>
                    </div>
                    <div class="itemsContent">
                        <div class="itemsContentLeftValue blue">
                            25%
                            <img src="../../../assets/images/airIndex/energy/16.png" />
                        </div>
                        <div class="itemsContentRightValue">818231.23</div>
                    </div>
                </div>
                <div class="items">
                    <div class="itemsTitle">
                        <div class="itemsTitleLeft">
                            <img src="../../../assets/images/airIndex/energy/7.png" />
                            <label>路灯耗电量（年）</label>
                        </div>
                    </div>
                    <div class="itemsContent">
                        <div class="itemsContentLeftValue blue">20%</div>
                        <div class="itemsContentRightValue">818231.23</div>
                    </div>
                </div>
            </div>
            <div class="floor-left-bottom-table">
                <div class="floor-left-bottom-table-all">
                    <div class="selectValue" style="background-color: #f5f5f5; margin: 10px">
                        <label class="value">
                            <span class="img">
                                <img src="../../../assets/images/airIndex/warn.png" />
                            </span>
                            <span class="title">告警信息</span>
                        </label>
                    </div>

                    <div id="chart-container" style="padding: 0 10px 10px 10px; height: calc(100vh - 570px); margin: 0 auto">
                        <el-table :data="dataList" style="width: 100%" size="small" border height="calc(100vh - 570px)">
                            <el-table-column prop="name" label="告警类型">
                                <template slot-scope="scope">
                                    <div class="alarm-type">
                                        <img :src="getImg(scope.row.name)" style="width: 15px; height: 15px" />
                                        <span>{{ scope.row.name }}</span>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column prop="value" label="告警次数" align="right">
                                <template slot-scope="scope">
                                    <label style="cursor: pointer">{{ scope.row.value }} <i class="el-icon-arrow-right"></i></label>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>
            </div>
        </div>
        <!-- <div class="floor-position"></div> -->
    </div>
</template>

<script>
import iconBorder from '@/components/newIndex/iconBorder'
import deviceLeftEcharts from './deviceLeftEcharts.vue'
import deviceLeftPieZb from './deviceLeftPieZb'
import deviceLeftTableList from './deviceLeftTableList'
import deviceLeftTableSbList from './deviceLeftTableSbList'
export default {
    props: ['currentNodeId', 'currentNodeName', 'dir'],
    components: {
        deviceLeftEcharts,
        deviceLeftPieZb,
        deviceLeftTableList,
        deviceLeftTableSbList,
        iconBorder
    },
    data() {
        return {
            year: '2025',
            yearList: [
                {
                    label: '2025',
                    value: '2025'
                },
                {
                    label: '2024',
                    value: '2024'
                }
            ],
            phIndex: 1,
            radio2: '2024',
            dataList: [
                {id: 1, value: 0, name: '脱机运行'},
                {id: 2, value: 0, name: '策略告警'},
                {id: 3, value: 0, name: '过载跳电'},
                {id: 4, value: 0, name: '恶性跳电'},
                {id: 7, value: 11, name: '设备离线'},
                {id: 8, value: 11, name: '网关离线'}
            ]
        }
    },
    computed: {},
    created() {},
    methods: {
        getImg(name) {
            if (name == '脱机运行') {
                return require('@/assets/images/airIndex/energy/6.png')
            }
            if (name == '策略告警') {
                return require('@/assets/images/airIndex/energy/1.png')
            }
            if (name == '过载跳电') {
                return require('@/assets/images/other/gztd.png')
            }
            if (name == '恶性跳电') {
                return require('@/assets/images/other/extd.png')
            }
            if (name == '设备离线') {
                return require('@/assets/images/other/yblx.png')
            }
            if (name == '网关离线') {
                return require('@/assets/images/other/wglx.png')
            }
        },
        getTitle() {
            var title = ''
            if (this.phIndex == 1) {
                title = '电'
            }
            if (this.phIndex == 2) {
                title = '水'
            }
            if (this.phIndex == 3) {
                title = '气'
            }
            if (this.phIndex == 4) {
                title = '热'
            }
            return title
        },
        changePh(index) {
            this.phIndex = index
        }
    }
}
</script>

<style scoped lang="scss">
.floorDetail {
    position: relative;
    background-color: #f5f5f5;
    display: flex;
    height: 100%;
    width: 100%;
    gap: 10px;
    .floor-position {
        position: absolute;
        right: -20px;
        top: 0;
        bottom: 0;
        width: 20px;
        background-color: #f5f5f5;
    }
    .floor-left-bottom-table {
        background-color: #f5f5f5;
        display: flex; /* flex布局 */
        justify-content: flex-start; /* 左对齐 */
        flex-wrap: wrap; /* 换行 */
        height: calc(100% - 370px);
        .floor-left-bottom-table-item {
            margin-right: 10px; /* 每个元素右间距设置为20px */
            width: calc((100% - 30px) / 3);
            position: relative;
            height: 100%;
            cursor: pointer;
            background-color: #fff;
        }
        .floor-left-bottom-table-all {
            width: 100%;
            position: relative;
            height: 100%;
            cursor: pointer;
            background-color: #fff;
            .alarm-type {
                display: flex;
                align-items: center;
                gap: 10px;
            }
        }
    }
    .floor-left {
        flex: 1;
        width: calc(100% - 310px);
    }
    .floor-left-top-table {
        height: 300px;
        margin: 10px 0;
        background-color: #fff;
        .items {
            box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
            background-color: #fff;
            padding: 10px;
            margin-bottom: 10px;
            border-radius: 4px;
            display: flex;
            flex-direction: column;
            .itemsTitle {
                display: flex;
                height: 32px;
                align-items: center;
                justify-content: center;
                width: 100%;

                .itemsTitleLeft {
                    display: flex;
                    flex: 1;
                    text-align: left;
                    // color: #3c5dea;
                    img {
                        width: 21px;
                        height: 21px;
                    }
                    label {
                        margin: 0 10px;
                    }
                }
            }
            .itemsContent {
                height: 30px;
                display: flex;
                padding: 10px;
                align-items: center;
                justify-content: center;
                .itemsContentLeftValue {
                    width: 40%;
                    text-align: center;
                    font-size: 20px;
                    font-weight: bold;
                }
                .red {
                    color: red;
                }
                .blue {
                    color: #3751ec;
                }
                .itemsContentRightValue {
                    flex: 1;
                    text-align: right;
                    font-family: 'led';
                    font-size: 24px;
                    // font-style: italic;
                    color: #3c5dea;
                    letter-spacing: 1px;
                    font-weight: 400;
                }
            }
        }
        .floor-left-top-table-center {
            text-align: center;
            div {
                margin-top: 10px;
                margin-bottom: 5px;
            }
        }
        .floor-left-top-table-bottom {
            display: flex;
            justify-content: flex-start;
            flex-wrap: wrap;
            .item {
                margin-left: 10px;
                width: calc((100% - 30px) / 2);
                height: 110px;
                position: relative;
                cursor: pointer;
                background-color: #fff;
                margin-bottom: 10px;
                border: 1px solid #e0e0e0;
                border-radius: 4px;
                .item-title {
                    font-size: 14px;
                    background-color: #f5f5f5;
                    height: 30px;
                    line-height: 30px;
                    text-align: center;
                    label {
                        font-size: 12px;
                    }
                }
                .item-value1 {
                    font-size: 16px;
                    color: #000;
                    text-align: center;
                    line-height: 30px;
                }
                .item-value2 {
                    font-size: 13px;
                    line-height: 27px;
                    text-align: left;
                    text-indent: 20px;
                }
                .item-label1 {
                    color: #666;
                    font-size: 13px;
                    text-align: left;
                    text-indent: 20px;
                    line-height: 20px;
                }
                .red {
                    color: red !important;
                }
            }
        }
    }
    .floor-right {
        background-color: #f5f5f5;
        width: 300px;
        margin-left: 0px;
        margin-right: 0px;
    }
}
.selectValue {
    display: flex;
    height: 50px;
    background: #fff;
    // margin-top: 5px;
    border-radius: 4px;
    line-height: 50px;
}
.selectValue .value {
    margin-left: 20px;
    font-size: 16px;

    .img {
        display: block;
        float: left;
        margin-top: 2px;
    }
    .title {
        margin-left: 10px;
    }
}
.selectValue .rightValue {
    flex: 1;
    text-align: right;
    margin-right: 10px;
    .btnList {
        padding-top: 5px;
        div {
            margin-left: 10px;
            cursor: pointer;
        }
        .hover {
            border-color: #2680fa !important;
        }
        .btnItem {
            display: inline-block;
            height: 26px;
            width: 60px;
            margin-top: 7px;
            margin-left: 10px;
            line-height: 23px;
            text-align: left;
            border: 1px solid #e0e0e0;
            border-radius: 4px;
            cursor: pointer;
            &:hover {
                border-color: #2680fa;
            }
            &:first-child {
                margin-left: 0 !important;
            }
            svg {
                margin-top: 2px;
                float: left;
                margin-left: 8px;
                margin-right: 3px;
            }
            label {
                font-size: 14px;
            }
        }
    }
}
.selectValue .rightValue span {
    font-size: 16px;
    color: #666;
}
.selectValue .rightValue span b {
    font-size: 16px;
    color: #333;
}
.selectValue .rightValue span label {
    width: 10px;
    display: inline-block;
    height: 10px;
    border-radius: 10px;
    margin-left: 40px;
    margin-right: 5px;
}

.cursor {
    cursor: pointer;
}
</style>
